package com.linkage.educloud.ah.bean;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Mr'Tang on 2018/12/11.
 */

public class VClassBean {
    private String childname; //孩子姓名
    private String childschool;//孩子所在学校
    private String childless;//孩子所在班级
    private int userdtime;//当月已使用的时间
    private int totaltime;//当月享受的班级网免费通话的总时间

    public static List<VClassBean> parseFromJson(JSONArray jsonArray) {
        List<VClassBean> list = new ArrayList<>();
        for (int a = 0; a < jsonArray.length(); a++) {
            VClassBean bean = new VClassBean();
            JSONObject obj = null;
            try {
                obj = jsonArray.getJSONObject(a);
            } catch (JSONException e) {
                e.printStackTrace();
            }
            bean.setChildname(obj.optString("childname"));
            bean.setChildschool(obj.optString("childschool"));
            bean.setChildless(obj.optString("childless"));
            bean.setUserdtime(obj.optInt("usedtime"));
            bean.setTotaltime(obj.optInt("totaltime"));
            list.add(bean);
        }
        return list;
    }

    public String getChildname() {
        return childname;
    }

    public void setChildname(String childname) {
        this.childname = childname;
    }

    public String getChildschool() {
        return childschool;
    }

    public void setChildschool(String childschool) {
        this.childschool = childschool;
    }

    public String getChildless() {
        return childless;
    }

    public void setChildless(String childless) {
        this.childless = childless;
    }

    public int getUserdtime() {
        return userdtime;
    }

    public void setUserdtime(int userdtime) {
        this.userdtime = userdtime;
    }

    public int getTotaltime() {
        return totaltime;
    }

    public void setTotaltime(int totaltime) {
        this.totaltime = totaltime;
    }
}
